var events = require("events");//原生模块
var Emitter = events.EventEmitter;
var eventObj = new Emitter();//事件对象实例化
eventObj.on("sayhello",function(){//监听
    console.log("hello world");
})

setTimeout(() => {
    events.emit("sayhello");//触发
}, 3000);